﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DailyStrips.ViewModel;
using DailyComics.Common.Model;
using DailyComics.Common.Model.ImageProvideStrategies;
using DailyComics.Common.Utilities.ImageProviderFactory;

namespace DailyComics.Windows
{
  /// <summary>
  /// Interaction logic for MainWindow.xaml
  /// </summary>
  public partial class MainWindow : Window
  {
    private MainWindowViewModel viewModel;

    public MainWindow()
    {
      InitializeComponent();

      MainModel model = new MainModel(ImageProviders.WulfMorgenthalerFactoryDK());

      viewModel = new MainWindowViewModel(model);
      
      this.DataContext = viewModel;
    }

    private void Button_Click_Back(object sender, RoutedEventArgs e)
    {
      viewModel.NavigateBack();
    }

    private void Button_Click_Forward(object sender, RoutedEventArgs e)
    {
      viewModel.NavigateForward();
    }

    private void Window_KeyUp(object sender, KeyEventArgs e)
    {
      switch (e.Key)
      {
        case Key.Left:
          viewModel.NavigateBack();
          break;
        case Key.Right:
          viewModel.NavigateForward();
          break;
        case Key.Escape:
          Application.Current.Shutdown();
          break;
        default:
          break;
      }
    }
  }
}
